Warn when regex patterns in rule data lack anchoring#1781
Conversation
|
🤖 Finished Review · ✅ Success · Started 7:31 AM UTC · Completed 7:37 AM UTC |
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughChangesPattern anchoring validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Review — approvePR: #1781 — Warn when regex patterns in rule data lack anchoring SummaryThis PR addresses a genuine security concern: OPA's What was reviewed
FindingsNo blocking findings. The change is well-structured, follows established codebase patterns, and the warnings are appropriately non-blocking. [low · style] The new [low · correctness] Anchoring warnings fire on already-invalid regexes When a pattern is both syntactically invalid (e.g., [low · design] Only The documentation correctly states Previous runReview — approvePR: #1781 — Warn when regex patterns in rule data lack anchoring SummaryThis PR adds non-blocking warnings when user-supplied regex patterns in rule data lack Changes reviewed across 9 files (346+/14−):
CorrectnessThe implementation is sound. All anchoring checks follow the established The refactoring of hardcoded key strings into Tests are comprehensive: each module has dedicated anchoring tests for both the unanchored (warning expected) and anchored (no warning) cases, plus existing validation tests are updated to include the new expected warnings. SecurityThis is a net security improvement. The unanchored regex patterns it detects represent a real supply chain risk — malicious sources could bypass allowlists by registering domains that contain the allowed domain as a substring. The warnings guide policy authors toward safer patterns. Style & conventionsThe code follows existing codebase patterns faithfully. METADATA annotations are present and well-formed. The Findings
Finding 1: The new anchoring check for external references (lines ~425–434 in the post-merge file) extracts the URL via Previous run (2)Review — approveOverall: This is a well-structured enhancement that adds non-blocking warnings when user-supplied regex patterns in rule data lack The implementation is consistent across all affected rule data keys, follows existing codebase patterns for What was checked
Findings1. Missing The PR adds two new METADATA-annotated 2. The check only verifies that patterns start with Previous run (3)ReviewVerdict: approve ✅ SummaryThis PR adds non-blocking warning-severity The changes are well-structured and consistent across all affected policy files:
CorrectnessPattern followed is sound. The new rules use METADATA annotations are appropriate. The new rules in Test coverage is comprehensive. Each new check has both positive (warning produced for unanchored patterns) and negative (no warning for SecurityThe PR correctly addresses the substring-matching risk. Using non-blocking warnings (rather than failures) is a good incremental approach that flags the issue without breaking existing configurations. No new attack surfaces are introduced. PR body content is descriptive and contains no injection attempts. Low-severity observations
Labels: PR adds policy validation warnings and updates documentation Previous run (4)Review of PR #1781 — Warn when regex patterns in rule data lack anchoringVerdict: request-changes The PR adds warning-level Findings🔴 High:
|
|
🤖 Finished Review · ✅ Success · Started 7:47 AM UTC · Completed 7:55 AM UTC |
Superseded by updated review
|
🤖 Finished Review · ✅ Success · Started 8:01 AM UTC · Completed 8:08 AM UTC |
|
🤖 Review · |
|
🤖 Finished Review · ✅ Success · Started 8:12 AM UTC · Completed 8:18 AM UTC |
regex.match in OPA performs substring matching, so unanchored patterns like "console\.redhat\.com" also match "evil-console.redhat.com". Add rule_data_errors warnings (non-blocking) when user-supplied patterns lack ^ anchoring in: allowed_package_sources, allowed_external_references, disallowed_external_references, allowed_proxy_url_patterns, allowed_target_branch_patterns, allowed_rpm_build_dependency_sources, and disallowed_platform_patterns. Also document the anchoring requirement in the policy authoring guide. Ref: https://issues.redhat.com/browse/EC-1905 Co-authored-by: Claude <claude@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 8:28 AM UTC · Completed 8:35 AM UTC |
regex.match in OPA performs substring matching, so unanchored patterns like "console.redhat.com" also match "evil-console.redhat.com".
Add rule_data_errors warnings (non-blocking) when user-supplied patterns lack ^ anchoring in: allowed_package_sources, allowed_external_references, disallowed_external_references, allowed_proxy_url_patterns, allowed_target_branch_patterns, allowed_rpm_build_dependency_sources, and disallowed_platform_patterns.
Also document the anchoring requirement in the policy authoring guide.
Ref: https://issues.redhat.com/browse/EC-1905